const std = @import("std");
const expect = std.testing.expect;

const directionLib = @import("../direction.zig");
const Direction = directionLib.Direction;


test "positions to direction" {
	var pos_start: [2]u8 = .{0, 0};
	var pos_end: [2]u8 = .{1, 0};
	var expected_direction = Direction{
		.up = false,
		.down = false,
		.left = false,
		.right = true,
	};
	var direction = Direction.as_direction(pos_start, pos_end);
	try expect(direction.eq(expected_direction));

	pos_start = .{20, 20};
	pos_end = .{40, 40};
	expected_direction = Direction{
		.up = false,
		.down = true,
		.left = false,
		.right = true,
	};
	direction = Direction.as_direction(pos_start, pos_end);
	try expect(direction.eq(expected_direction));

	pos_start = .{20, 20};
	pos_end = .{0, 13};
	expected_direction = Direction{
		.up = true,
		.down = false,
		.left = true,
		.right = false,
	};
	direction = Direction.as_direction(pos_start, pos_end);
	try expect(direction.eq(expected_direction));
}
